<template>

    <el-table :data="customer_group_list">

        <el-table-column property="id" label="群组ID" width="" >

        </el-table-column>

        <el-table-column property="name" label="名称" width="" >

        </el-table-column>
        
        <el-table-column property="sort_order" label="排序" width="" >

        </el-table-column>

        <el-table-column property="is_default" label="是否为默认群组" width="" >
            <template #default="scope">
                <span v-show="scope.row.is_default==0" >否</span>
                <span v-show="scope.row.is_default==1" >是</span>
            </template>
        </el-table-column>

        <el-table-column  label="管理" width="">

            <template #default="scope">

                <a class="el-button el-button--primary" 
                    :href="'/main/customer/group/edit/'+ scope.row.id"> 编辑 </a>

            </template>
        </el-table-column>

    </el-table>

    <div style="height:20px"></div>
    <el-row>
        <el-col>
            <a class="el-button el-button--primary" 
                    href="#/main/customer/group/create"> 添加 </a>
        </el-col>
    </el-row>
</template>

<script lang="ts" setup>

import {ref} from "vue";
import axios from "axios";
const VITE_URL = window.VITE_URL;

const customer_group_list = ref<Array<object>>([])
const get_customer_group_list = ()=>{

    const url = VITE_URL + '/admin.customerGroup/index'
    axios.get( url ).then( res =>{

        customer_group_list.value = res.data;

    })

}

get_customer_group_list();
</script>